package com.yykj.backstage.all.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yykj.backstage.all.dto.HospitalAgreementSearchDTO;
import com.yykj.backstage.all.model.entity.HospitalAgreement;
import com.yykj.backstage.all.service.HospitalAgreementService;
import com.yykj.common.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/backstage/agreement")
@Api(tags = "用户协议和隐私政策相关接口")
@SuppressWarnings(value = "unchecked")
public class HospitalAgreementController {

    @PostMapping("/edit")
    @ApiOperation("添加修改")
    @ApiOperationSupport(ignoreParameters = {"addTime"})
    public ResultVO<HospitalAgreement> editHospitalAgreement(@RequestBody HospitalAgreement hospitalAgreement) {
        return ResultVO.success(service.editHospitalAgreement(hospitalAgreement));
    }

    @GetMapping("/view")
    @ApiOperation("查看")
    public ResultVO<HospitalAgreement> viewHospitalAgreement(HospitalAgreementSearchDTO searchDTO) {
        return ResultVO.success(service.viewHospitalAgreement(searchDTO));
    }

    @GetMapping("/list")
    @ApiOperation("列表")
    public ResultVO<List<HospitalAgreement>> listHospitalAgreement() {
        return ResultVO.success(service.listHospitalAgreement());
    }


    private HospitalAgreementService service;

    @Autowired
    public void setService(HospitalAgreementService service) {
        this.service = service;
    }
}
